<?php
/**
 * @Notes:【】
 * @Date: 2022-06-05 15:25
 */

namespace App\Controller\Admin\Task;

use App\Controller\AbstractController;
use App\Controller\Admin\BaseController;
use App\Middleware\CheckAdminMiddleware;
use App\Service\Task\TaskService;
use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\Middleware;
use Yj\Apidog\Annotation\ApiController;
use Yj\Apidog\Annotation\FormData;
use Yj\Apidog\Annotation\PostApi;

/**
 * @ApiController(prefix="admin/task/task-recomment")
 * @Middleware(CheckAdminMiddleware::class)
 */
class TaskRecommentController extends BaseController
{
    /**
     * @Inject()
     * @var TaskService
     */
    protected $taskService;

    /**
     * @Notes:【】
     * @Date: 2022-06-05 15:25
     * @PostApi(path="recomment")
     * @FormData(key="task_id")
     * @FormData(key="recomment_reason")
     */
    public function recomment()
    {
        $data = $this->getData(false);

        $this->taskService->recomment($data);
        _SUCCESS();
    }


    /**
     * @Notes:【】
     * @Date: 2022-06-05 15:25
     * @PostApi(path="cancel")
     * @FormData(key="task_id")
     */
    public function cancel()
    {
        $data = $this->getData(false);
        $this->taskService->cancelRecomment($data);
        _SUCCESS();
    }


    /**
     * @Notes:【】
     * @Date: 2022-06-05 15:25
     * @PostApi(path="lists")
     */
    public function lists()
    {
        $params = $this->getValidatorData();
        $data = $this->taskService->lists($params);
        _SUCCESS($data);
    }

    /**
     * @Notes:【】
     * @Date: 2022-06-06 0:08
     * @PostApi(path="audit")
     * @FormData(key="task_id")
     * @FormData(key="reason")
     * @FormData(key="status")
     */
    public function audit()
    {

        $this->taskService->audit($this->getData());
        _SUCCESS();
    }
}